﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using WGLGridView;
using DBAccessor.Accessor;
using AlanUtilities;
using DBList.Entities;
using DBList;
using System.Collections.Generic;

public partial class MemberManage : System.Web.UI.Page
{
	protected void Page_Load(object sender, EventArgs e)
	{
		operaterLabel.Text = @"";
		String strUID = OperateControl.PickupAvaiableUserID(this);
		operaterLabel.Text = strUID;
		if (!IsPostBack){
			BindGrideView();
		}
	}
	private void ShowEmptyRecord()
	{
		string[] fields = { "StateName", "MemberName", "RoleName", "RealName", "Phone", "AddDate", "Introduction", "Address", "MemberId" };
		WGLGridView.WGLGridView.ClearAndShowEmptyGridView(GridView1, fields);
	}
	protected void AspNetPager1_PageChanged(object sender, EventArgs e)
	{
		BindGrideView();
	}
	protected void BindGrideView()
	{
		string namematch = tbRealName.Text.Trim();
		string mdmcmatch = tbMDName.Text.Trim();
		int noutTotal = 0;

		MemberAccessor	memAcce = new MemberAccessor();
		List<UserData> listData = memAcce.GetAllMemberData(AspNetPager1.CurrentPageIndex, AspNetPager1.PageSize, out noutTotal, namematch, mdmcmatch);
		GridView1.DataSource = listData;
		AspNetPager1.RecordCount = noutTotal;
		if (listData.Count == 0)
		{
			ShowEmptyRecord();
		}
		else
		{
			GridView1.DataBind();
		}
		recLabel.Text = @"总记录：";
		recLabel.Text += noutTotal.ToString();
		recLabel.Text += @" 条";
	}
	protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
	{
		if (e.Row.RowType == DataControlRowType.DataRow)
		{
			e.Row.Attributes.Add("onclick", "GridView_selectRow(this)");
			e.Row.Height = 25;
		}
		else if (e.Row.RowType == DataControlRowType.Header)
		{
			e.Row.Height = 25;
		}
	}
	protected void btnSearch_Click(object sender, EventArgs e)
	{
		BindGrideView();
	}
}
